<?php
//404错误处理
$container['notFoundHandler'] = function($c) {
	return function($request, $response) use ($c) {
		include APP_PATH. "Views/404.html";
		//		return $c['response'] -> withStatus(404) -> withHeader('Content-Type', 'text/html') -> write('Page not found');
	};
};

////500
//$container['errorHandler'] = function($c) {
//	return function($request, $response, $exception) use ($c) {
//		return $c['response'] -> withStatus(500) -> withHeader('Content-Type', 'text/html') -> write('Something went wrong!');
//	};
//};
//405禁止访问
$container['notAllowedHandler'] = function($c) {
	return function($request, $response, $methods) use ($c) {
		return $c['response'] -> withStatus(405) -> withHeader('Allow', implode(', ', $methods)) -> withHeader('Content-type', 'text/html') -> write('Method must be one of: ' . implode(', ', $methods));
	};
};
?>